package com.dlc.apk.utils

import java.text.SimpleDateFormat
import java.util.*

object DateUtil {
    const val yyyyMMddHHmmss = "yyyyMMddHHmmss"
    fun nowToDate(pattern: String?): String {
        val simpleDateFormat = SimpleDateFormat(pattern)
        return simpleDateFormat.format(Date())
    }

    fun nowToString(): String {
        return nowToDate(yyyyMMddHHmmss)
    }

    fun isInNow(startTime: String, endTime: String): Boolean {
        val sdf = SimpleDateFormat("HH:mm:ss")
        val startDate = sdf.parse(startTime)
        val endDate = sdf.parse(endTime)
        val nowDate = sdf.parse(sdf.format(Date()))
        return nowDate in startDate..endDate
    }
}